home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- COPYIGHT
-
- ©1995 Dietmar Eilert (e-mail: DIETMAR@TOMATE.TNG.OCHE.DE). All Rights
- Reserved. Code may not be reused/reproduced without written permission of
- the author.
-
- Dietmar Eilert
- Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
- E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
- Tel: +49-(0)241-81665
- +49-(0)2525-7776
- Fax: +49-(0)241-81665
-
- Example: scan handler looking for Basic subroutines (SUB or PROCEDURE). Scan
- handlers are plain functions (LoadSeg'ed by GED): no standard C startup code,
- no library calls.
-
- DICE-C:
-
- dcc basic.c -// -l0 -md -mRR -o ram:basic
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- ULONG
- ScanHandlerBasic(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- const char *version = "$VER: Basic 1.0 (" __COMMODORE_DATE__ ")";
-
- if (len > 4) {
-
- if (**text == 'S') {
-
- if (((*text)[1] == 'U') && ((*text)[2] == 'B') && ((*text)[3] == ' ')) {
-
- // found SUB subroutine
-
- *text += 4;
-
- return(len - 4);
- }
- }
- else {
-
- if (**text == '>') {
-
- *text += 2;
- len -= 2;
- }
-
- if ((len > 10) && (**text == 'P')) {
-
- if (((*text)[1] == 'R') && ((*text)[2] == 'O') && ((*text)[3] == 'C') && ((*text)[4] == 'E') && ((*text)[5] == 'D') && ((*text)[6] == 'U') && ((*text)[7] == 'R') && ((*text)[8] == 'E') && ((*text)[9] == ' ')) {
-
- // found PROCEDURE
-
- *text += 10;
-
- return(len - 10);
- }
- }
- }
- }
-
- return(FALSE);
- }
-
-